"""
31 - Dars Mavzu: Modul
"""


import random
from datetime import date, timedelta, datetime
# import locale

# date
TODAY = date.today()
print(TODAY) # 2022-11-01
print(TODAY.day) # 10
print(TODAY.month) # 7
print(TODAY.year) # 2019
print(TODAY.weekday()) # weekday - haftaning
# nechanchi kuni ekanini ko`rsatadi.
# 0 dan boshlab sanaydi.

# datetime
print('##################################')
NOW1 = datetime.now() #pylint:disable=undefined-variable
NOW2 = datetime.today() #pylint:disable=undefined-variable

print(NOW1) # 2019-07-10 14:16:51.696373
print(NOW1.day) # 10
print(NOW1.month, 'oy') # 8
print(NOW1.year) # 2019
print(NOW1.weekday()) # 2
print(NOW1.hour) # 14
print(NOW1.minute) # 16
print(NOW1.second) # 51
print('#######################')
DAYS = ['Du', 'Se', 'Chor', 'Pay', 'Ju', 'Sh', 'Yak']
print(DAYS[NOW1.weekday()]) # ср

# locale.setlocale(locale.LC_ALL, 'ru_RU.UTF-8')
# locale.setlocale(locale.LC_ALL, 'ru_RU')

NOWW = datetime.now() #pylint: disable=undefined-variable
print(NOWW, 'shu yer noww')

print(NOWW.strftime('%a'))
print(NOWW.strftime('%A'))

print(f'Sana: {NOWW.strftime("%A, %d %B %y")}')
print(f'Vaqt: {NOWW.strftime("%H:%M:%S")}')

print(NOWW.strftime('%c'))
print(NOWW.strftime('%x'))
print(NOWW.strftime('%X'))

NOW = datetime.today() #pylint: disable=undefined-variable
print(NOW.strftime('%c'))
DD1 = NOW + timedelta(days=1, hours=0, minutes=0)
print(DD1.strftime('%c'))

XX = random.randint(1, 100)
print(XX)
USER_NUM = 0
CNT = 0

while True:
    USER_NUM = int(input('Sonni top: '))
    CNT += 1
    if USER_NUM == XX:
        print(f'Sonni topdingiz! Urinishlar soni {CNT}ta')
        print("""
                ------------
                |           |
                |  0     0  |
                |     <     |
                |  .     .  |
                |   `...`   |
                ------------
                """)
        if input('Yana o`ynaymizmi? ha|yo`q:') == 'y' or 'h':
            continue
            XX = random.randint(1, 100)
            print(XX)
            CNT = 0
        else:
            print('Tashakkur!')
            break
    elif USER_NUM > XX:
        print('Raqm bundan kichik')
    else:
        print('Raqam bundan katta')
